#pragma once

#include <iostream>
#include <string>

using namespace std;

// 假设有个 Messager 类
// 客户端调用这个类实现通信功能
class Messager {
public:
	Messager() {}
	virtual ~Messager() {}

	virtual void Login(string username, string password) = 0;
	virtual void SendMessage(string message) = 0;
	virtual void SendPictrue(string image_path) = 0;

	
};

class MessagerImp {
public:
    MessagerImp() {}
    virtual ~MessagerImp() {}

    virtual void PlaySound() = 0;
	virtual void DrawShape() = 0;
	virtual void WirteText() = 0;
	virtual void Connect() = 0;
};

// 平台实现
class PCMessagerBase : public MessagerImp {
public:

    virtual void PlaySound() {

    }
    virtual void DrawShape() {

    }
    virtual void WirteText() {

    }
    virtual void Connect() {

    }
};

// 业务抽象
// 经典版
class MessagerLite : public Messager {
    // PCMessagerBase *messager = nullptr;
    MessagerImp *messager = nullptr; // 未来用的时候可以new成 PCMessagerBase

public:
    virtual void Login(string username, string password) {
        messager->Connect();
    }
    virtual void SendMessage(string message) {
        messager->WirteText();
    }
    virtual void SendPictrue(string image_path) {
        messager->DrawShape();
    }
};

// 完整版
class MessagerFull : public Messager {
    MessagerImp *messager = nullptr; // 未来用的时候可以new成 PCMessagerBase

public:
    virtual void Login(string username, string password) {
        messager->PlaySound();
        messager->Connect();
    }
    virtual void SendMessage(string message) {
        messager->PlaySound();
        messager->WirteText();
    }
    virtual void SendPictrue(string image_path) {
        messager->PlaySound();
        messager->DrawShape();
    }
};

// 移动端平台实现
class MoblicMessagerBase : public MessagerImp {

};

void Process() {
    Messager *pc = new MessagerLite;
    // 注意 messager指针对象后面得自己放到构造函数里面手动new
    delete pc;
    // MoblicMessagerBase *m = new MoblieMessagerFull;
    // delete m;
}
